package ui.map 
{
	import com.asual.swfaddress.SWFAddress;
	import flash.display.Bitmap;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import utils.SpriteUtil;
	
	/**
	 * ...
	 * @author usual
	 */
	public class Credits extends MovieClip 
	{
		[Embed(source = '../../assets/credits.png')]
		private var Picture:Class;
		private var _pic:Bitmap;
		public function Credits() 
		{
			addEventListener(Event.ADDED_TO_STAGE, _build);
		}
		
		private function _build(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, _build);
			addPicture();
			addClickTags();
		}
		
		private function addClickTags():void 
		{
			trace("[Credits.addClickTags] ");
			
			
			var cl1:Sprite = SpriteUtil.drawRectSprite(36, 15);
			cl1.name = "cl1";
			cl1.x = 118;
			cl1.y = 22;
			addChild(cl1);
			
			var cl2:Sprite = SpriteUtil.drawRectSprite(36, 15);
			cl2.name = "cl2";
			cl2.x = 247;
			cl2.y = 22;
			addChild(cl2);
			cl2.alpha = cl1.alpha = 0;
			cl1.buttonMode = cl2.buttonMode = true;
			cl1.addEventListener(MouseEvent.CLICK, _clikCredits);
			cl2.addEventListener(MouseEvent.CLICK, _clikCredits);
			
			
		}
		
		private function _clikCredits(e:MouseEvent):void 
		{
			if (e.currentTarget.name == 'cl1')SWFAddress.href("http://www.iceberg.fr", "_blank");
			else SWFAddress.href("http://www.neusphotos.com", "_blank");
		}
		
		private function addPicture():void 
		{
			_pic = new Picture();
			addChild(_pic);
		}
		
	}

}